package cn.da.shuai.cool.finance.mapper;

import cn.da.shuai.cool.finance.model.CoolFinancialAnalytics;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CoolFinancialAnalyticsMapper extends BaseMapper<CoolFinancialAnalytics> {

    @Select("SELECT * FROM cool_financial_analytics WHERE fiscal_year = #{fiscalYear} AND department_id = #{departmentId} ORDER BY analysis_date DESC")
    List<CoolFinancialAnalytics> findByFiscalYearAndDepartment(Integer fiscalYear, Long departmentId);

    @Select("SELECT * FROM cool_financial_analytics WHERE fiscal_year = #{fiscalYear} AND fiscal_month = #{fiscalMonth} ORDER BY department_id")
    List<CoolFinancialAnalytics> findByFiscalYearAndMonth(Integer fiscalYear, Integer fiscalMonth);
}